#include "avatar_modify_thread.h"

#include "0-data/db/avatar_db.h"

AvatarModifyThread::AvatarModifyThread(QObject *parent)
    : QThread(parent)
{

}

void AvatarModifyThread::SetParams(const QList<Avatar> &avatars, const int work_type)
{
    avatars_ = avatars;
    work_type_ = work_type;
}

void AvatarModifyThread::run()
{
    AvatarDb db;
    if(work_type_ == ENUM_INSERT)
    {
        db.SaveAvatars(avatars_);
    }
    else if(work_type_ == ENUM_DELETE)
    {
        db.DeleteAvatars(avatars_);
    }
}
